home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Programming / powerd / modules.lha / modules / dos / dos.m < prev    next >
Encoding:
Text File  |  2000-08-30  |  8.8 KB  |  241 lines

  1.  
  2. #define     DOSNAME  'dos.library'
  3.  
  4. /* Predefined Amiga DOS global constants */
  5.  
  6. CONST    DOSTRUE=-1,
  7.         DOSFALSE=0
  8.  
  9. /* Mode parameter to Open() */
  10. CONST    MODE_OLDFILE=1005,
  11.                         /* Open existing file read/write
  12.                          * positioned at beginning of file. */
  13.         MODE_NEWFILE=1006,
  14.                         /* Open freshly created file (delete
  15.                          * old file) read/write, exclusive lock. */
  16.         MODE_READWRITE=1004
  17.                         /* Open old file w/shared lock,
  18.                          * creates file if doesn't exist. */
  19.  
  20. /* Relative position to Seek() */
  21. CONST    OFFSET_BEGINNING=-1,        /* relative to Begining Of File */
  22.         OFFSET_CURRENT=    0,        /* relative to Current file position */
  23.         OFFSET_END=            1        /* relative to End Of File      */
  24.  
  25. CONST    OFFSET_BEGINING=OFFSET_BEGINNING  /* ancient compatibility */
  26.  
  27. CONST    BITSPERBYTE=8
  28. CONST    BYTESPERLONG=4
  29. CONST    BITSPERLONG=32
  30. CONST    MAXINT=$7FFFFFFF
  31. CONST    MININT=$80000000
  32.  
  33. /* Passed as type to Lock() */
  34. CONST    SHARED_LOCK=-2            /* File is readable by others */
  35. CONST    ACCESS_READ=-2            /* Synonym */
  36. CONST    EXCLUSIVE_LOCK=-1        /* No other access allowed      */
  37. CONST    ACCESS_WRITE=-1        /* Synonym */
  38.  
  39. OBJECT DateStamp
  40.     Days:LONG,          /* Number of days since Jan. 1, 1978 */
  41.     Minute:LONG,      /* Number of minutes past midnight */
  42.     Tick:LONG          /* Number of ticks past minute */
  43.  
  44. #define TICKS_PER_SECOND      50   /* Number of ticks in one second */
  45.  
  46. /* Returned by Examine() and ExNext(), must be on a 4 byte boundary */
  47. OBJECT FileInfoBlock|FIB
  48.     DiskKey:LONG,
  49.     DirEntryType:LONG,    /* Type of Directory. If < 0, then a plain file.
  50.                                  * If > 0 a directory */
  51.     FileName[108]:UBYTE,    /* Null terminated. Max 30 chars used for now */
  52.     Protection:LONG,        /* bit mask of protection, rwxd are 3-0.       */
  53.     EntryType:LONG,
  54.     Size:LONG,                /* Number of bytes in file */
  55.     NumBlocks:LONG,        /* Number of blocks in file */
  56.     Date:DateStamp,        /* Date file last changed */
  57.     Comment[80]:UBYTE,    /* Null terminated comment associated with file */
  58.     
  59.    /* Note: the following fields are not supported by all filesystems.    */
  60.    /* They should be initialized to 0 sending an ACTION_EXAMINE packet.    */
  61.    /* When Examine() is called, these are set to 0 for you.        */
  62.    /* AllocDosObject() also initializes them to 0.            */
  63.     OwnerUID:UWORD,        /* owner's UID */
  64.     OwnerGID:UWORD,        /* owner's GID */
  65.  
  66.     Reserved[32]:UBYTE
  67.  
  68. /* FIB stands for FileInfoBlock */
  69.  
  70. /* FIBB are bit definitions, FIBF are field definitions */
  71. /* Regular RWED bits are 0 == allowed. */
  72. /* NOTE: GRP and OTR RWED permissions are 0 == not allowed! */
  73. /* Group and Other permissions are not directly handled by the filesystem */
  74. #define FIBB_OTR_READ       15    /* Other: file is readable */
  75. #define FIBB_OTR_WRITE       14    /* Other: file is writable */
  76. #define FIBB_OTR_EXECUTE   13    /* Other: file is executable */
  77. #define FIBB_OTR_DELETE    12    /* Other: prevent file from being deleted */
  78. #define FIBB_GRP_READ       11    /* Group: file is readable */
  79. #define FIBB_GRP_WRITE       10    /* Group: file is writable */
  80. #define FIBB_GRP_EXECUTE   9    /* Group: file is executable */
  81. #define FIBB_GRP_DELETE    8    /* Group: prevent file from being deleted */
  82.  
  83. #define FIBB_SCRIPT    6        /* program is a script (execute) file */
  84. #define FIBB_PURE      5        /* program is reentrant and rexecutable */
  85. #define FIBB_ARCHIVE   4        /* cleared whenever file is changed */
  86. #define FIBB_READ      3        /* ignored by old filesystem */
  87. #define FIBB_WRITE     2        /* ignored by old filesystem */
  88. #define FIBB_EXECUTE   1        /* ignored by system, used by Shell */
  89. #define FIBB_DELETE    0        /* prevent file from being deleted */
  90.  
  91. #define FIBF_OTR_READ       (1<<FIBB_OTR_READ)
  92. #define FIBF_OTR_WRITE       (1<<FIBB_OTR_WRITE)
  93. #define FIBF_OTR_EXECUTE   (1<<FIBB_OTR_EXECUTE)
  94. #define FIBF_OTR_DELETE    (1<<FIBB_OTR_DELETE)
  95. #define FIBF_GRP_READ       (1<<FIBB_GRP_READ)
  96. #define FIBF_GRP_WRITE       (1<<FIBB_GRP_WRITE)
  97. #define FIBF_GRP_EXECUTE   (1<<FIBB_GRP_EXECUTE)
  98. #define FIBF_GRP_DELETE    (1<<FIBB_GRP_DELETE)
  99.  
  100. #define FIBF_SCRIPT    (1<<FIBB_SCRIPT)
  101. #define FIBF_PURE      (1<<FIBB_PURE)
  102. #define FIBF_ARCHIVE   (1<<FIBB_ARCHIVE)
  103. #define FIBF_READ      (1<<FIBB_READ)
  104. #define FIBF_WRITE     (1<<FIBB_WRITE)
  105. #define FIBF_EXECUTE   (1<<FIBB_EXECUTE)
  106. #define FIBF_DELETE    (1<<FIBB_DELETE)
  107.  
  108. /* Standard maximum length for an error string from fault.  However, most */
  109. /* error strings should be kept under 60 characters if possible.  Don't   */
  110. /* forget space for the header you pass in. */
  111. #define FAULT_MAX    82
  112.  
  113. /* BCPL strings have a length in the first byte and then the characters.
  114.  * For example:     s[0]=3 s[1]=S s[2]=Y s[3]=S                 */
  115.  
  116. /* returned by Info(), must be on a 4 byte boundary */
  117. OBJECT InfoData
  118.     NumSoftErrors:LONG,    /* number of soft errors on disk */
  119.     UnitNumber:LONG,        /* Which unit disk is (was) mounted on */
  120.     DiskState:LONG,            /* See defines below */
  121.     NumBlocks:LONG,            /* Number of blocks on disk */
  122.     NumBlocksUsed:LONG,    /* Number of block in use */
  123.     BytesPerBlock:LONG,
  124.     DiskType:LONG,            /* Disk Type code */
  125.     VolumeNode:BPTR,        /* BCPL pointer to volume node */
  126.     InUse:LONG                /* Flag, zero if not in use */
  127.  
  128. /* ID stands for InfoData */
  129.     /* Disk states */
  130. #define ID_WRITE_PROTECTED    80     /* Disk is write protected */
  131. #define ID_VALIDATING        81     /* Disk is currently being validated */
  132. #define ID_VALIDATED            82     /* Disk is consistent and writeable */
  133.  
  134.     /* Disk types */
  135. /* ID_INTER_* use international case comparison routines for hashing */
  136. /* Any other new filesystems should also, if possible. */
  137. #define ID_NO_DISK_PRESENT        -1
  138. #define ID_UNREADABLE_DISK        $42414400    /* 'BAD\0' */
  139. #define ID_DOS_DISK                $444F5300    /* 'DOS\0' */
  140. #define ID_FFS_DISK                $444F5301    /* 'DOS\1' */
  141. #define ID_INTER_DOS_DISK        $444F5302    /* 'DOS\2' */
  142. #define ID_INTER_FFS_DISK        $444F5303    /* 'DOS\3' */
  143. #define ID_FASTDIR_DOS_DISK    $444F5304    /* 'DOS\4' */
  144. #define ID_FASTDIR_FFS_DISK    $444F5305    /* 'DOS\5' */
  145. #define ID_NOT_REALLY_DOS        $4E444F53    /* 'NDOS'  */
  146. #define ID_KICKSTART_DISK        $4B49434B    /* 'KICK'  */
  147. #define ID_MSDOS_DISK            $4d534400    /* 'MSD\0' */
  148.  
  149. /* Errors from IoErr(), etc. */
  150. CONST    ERROR_NO_FREE_STORE            =103,
  151.         ERROR_TASK_TABLE_FULL        =105,
  152.         ERROR_BAD_TEMPLATE            =114,
  153.         ERROR_BAD_NUMBER                =115,
  154.         ERROR_REQUIRED_ARG_MISSING    =116,
  155.         ERROR_KEY_NEEDS_ARG            =117,
  156.         ERROR_TOO_MANY_ARGS            =118,
  157.         ERROR_UNMATCHED_QUOTES        =119,
  158.         ERROR_LINE_TOO_LONG            =120,
  159.         ERROR_FILE_NOT_OBJECT        =121,
  160.         ERROR_INVALID_RESIDENT_LIBRARY=122,
  161.         ERROR_NO_DEFAULT_DIR            =201,
  162.         ERROR_OBJECT_IN_USE            =202,
  163.         ERROR_OBJECT_EXISTS            =203,
  164.         ERROR_DIR_NOT_FOUND            =204,
  165.         ERROR_OBJECT_NOT_FOUND        =205,
  166.         ERROR_BAD_STREAM_NAME        =206,
  167.         ERROR_OBJECT_TOO_LARGE        =207,
  168.         ERROR_ACTION_NOT_KNOWN         =209,
  169.         ERROR_INVALID_COMPONENT_NAME=210,
  170.         ERROR_INVALID_LOCK            =211,
  171.         ERROR_OBJECT_WRONG_TYPE        =212,
  172.         ERROR_DISK_NOT_VALIDATED    =213,
  173.         ERROR_DISK_WRITE_PROTECTED    =214,
  174.         ERROR_RENAME_ACROSS_DEVICES=215,
  175.         ERROR_DIRECTORY_NOT_EMPTY    =216,
  176.         ERROR_TOO_MANY_LEVELS        =217,
  177.         ERROR_DEVICE_NOT_MOUNTED    =218,
  178.         ERROR_SEEK_ERROR                =219,
  179.         ERROR_COMMENT_TOO_BIG        =220,
  180.         ERROR_DISK_FULL                =221,
  181.         ERROR_DELETE_PROTECTED        =222,
  182.         ERROR_WRITE_PROTECTED        =223,
  183.         ERROR_READ_PROTECTED            =224,
  184.         ERROR_NOT_A_DOS_DISK            =225,
  185.         ERROR_NO_DISK                    =226,
  186.         ERROR_NO_MORE_ENTRIES        =232,
  187. /* added for 1.4 */
  188.         ERROR_IS_SOFT_LINK            =233,
  189.         ERROR_OBJECT_LINKED            =234,
  190.         ERROR_BAD_HUNK                    =235,
  191.         ERROR_NOT_IMPLEMENTED        =236,
  192.         ERROR_RECORD_NOT_LOCKED        =240,
  193.         ERROR_LOCK_COLLISION            =241,
  194.         ERROR_LOCK_TIMEOUT            =242,
  195.         ERROR_UNLOCK_ERROR            =243
  196.  
  197. /* error codes 303-305 are defined in dosasl.h */
  198.  
  199. /* These are the return codes used by convention by AmigaDOS commands */
  200. /* See FAILAT and IF for relvance to EXECUTE files              */
  201. CONST    RETURN_OK        =0,    /* No problems, success */
  202.         RETURN_WARN        =5,    /* A warning only */
  203.         RETURN_ERROR    =10,    /* Something wrong */
  204.         RETURN_FAIL        =20    /* Complete or severe failure*/
  205.  
  206. /* Bit numbers that signal you that a user has issued a break */
  207. FLAG    SIGBREAK_CTRL_C=12,
  208.         SIGBREAK_CTRL_D,
  209.         SIGBREAK_CTRL_E,
  210.         SIGBREAK_CTRL_F
  211.  
  212. /* Values returned by SameLock() */
  213. #define LOCK_DIFFERENT        -1
  214. #define LOCK_SAME                0
  215. #define LOCK_SAME_VOLUME    1    /* locks are on same volume */
  216. #define LOCK_SAME_HANDLER    LOCK_SAME_VOLUME
  217. /* LOCK_SAME_HANDLER was a misleading name, def kept for src compatibility */
  218.  
  219. /* types for ChangeMode() */
  220. #define CHANGE_LOCK    0
  221. #define CHANGE_FH        1
  222.  
  223. /* Values for MakeLink() */
  224. #define LINK_HARD    0
  225. #define LINK_SOFT    1    /* softlinks are not fully supported yet */
  226.  
  227. /* values returned by ReadItem */
  228. #define    ITEM_EQUAL        -2        /* "=" Symbol */
  229. #define ITEM_ERROR        -1        /* error */
  230. #define ITEM_NOTHING        0        /* *N, ;, endstreamch */
  231. #define ITEM_UNQUOTED    1        /* unquoted item */
  232. #define ITEM_QUOTED        2        /* quoted item */
  233.  
  234. /* types for AllocDosObject/FreeDosObject */
  235. #define DOS_FILEHANDLE        0    /* few people should use this */
  236. #define DOS_EXALLCONTROL    1    /* Must be used to allocate this! */
  237. #define DOS_FIB                2    /* useful */
  238. #define DOS_STDPKT            3    /* for doing packet-level I/O */
  239. #define DOS_CLI                4    /* for shell-writers, etc */
  240. #define DOS_RDARGS            5    /* for ReadArgs if you pass it in */
  241.